home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_08_07 / 8n07088a < prev    next >
Text File  |  1990-06-17  |  761b  |  29 lines

  1.  
  2.           #include <stdio.h>
  3.  
  4.           struct record
  5.                {
  6.                char first_name[15];
  7.                char last_name[15];
  8.                };
  9.           
  10.           main()
  11.                {
  12.                struct record rec;
  13.                FILE *fptr;
  14.  
  15.                fptr = fopen("test.fil","rt");
  16.                fread(&rec, sizeof(rec), 1, fptr);
  17.                printf("First Name: %s\n", rec.first_name);
  18.                printf("Last Name : %s\n", rec.last_name);
  19.                fclose(fptr);
  20.               }
  21.  
  22.      Sample file generated by BASIC PRINT#:
  23.           a123456789012345b23456789012345
  24.  
  25.      Sample output from C:
  26.           First Name: a23456789012345b23456789012345
  27.           Last Name : b23456789012345
  28.  
  29.